package com.ibigcat.module.system.enums.common;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.ibigcat.framework.common.annotation.EnumType;
import com.ibigcat.framework.common.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author Mr.HRL
 * @version 1.0
 * @since 2023/7/3 10:36
 */
@Getter
@AllArgsConstructor
@EnumType("DisableEnum")
public enum DisableEnum implements BaseEnum {

    ADD("-1","新增"),

    ENABLE("0","已启用"),

    DISABLE("1","已停用");

    @EnumValue
    private String code;

    @JsonValue
    private String name;

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getName() {
        return name;
    }

    public static DisableEnum getEnumByCode(String code){
        for (DisableEnum disableEnum: DisableEnum.values()) {
            if (disableEnum.code.equals(code)){
                return disableEnum;
            }
        }
        return null;
    }
}
